/*
 * @Description: rem计算
 * @Author: 0001100986/LiuShuai
 * @Date: 2021-06-22 14:09:49
 * @LastEditTime: 2021-07-16 09:38:31
 * @LastEditors: 0001100986/LiuShuai
 */
(function(doc, win) {
  let docEl = doc.documentElement;
  let resizeEvt = 'orientationchange' in window ? 'orientationchange' : 'resize';

  let setFontSize = function() {
    let clientWidth = docEl.clientWidth;
    if (!clientWidth) {
      return;
    }
    docEl.style.fontSize = 100 * (clientWidth / 1920) + 'px';
  };

  if (!doc.addEventListener) {
    return;
  }
  win.addEventListener(resizeEvt, setFontSize, false);
  doc.addEventListener('DOMContentLoaded', setFontSize, false);

  setFontSize();
})(document, window);
